package auth

import (
	"admin/dao/auth"
	dto "admin/dto"
	"admin/modules/auth/logic"
	"admin/utils"
	"admin/utils/response"
	"github.com/gin-gonic/gin"
	"gorm.io/gorm"
	"net/http"
)

type OperationLogController struct {
	operaLogic *logic.OperationLogLogic
}

func NewOperationLogController(db *gorm.DB) *OperationLogController {
	return &OperationLogController{
		operaLogic: logic.NewOperationLogLogic(auth.NewOperationLogRepo(db)),
	}
}

// List 操作日志列表
func (op *OperationLogController) List(c *gin.Context) {
	req, _ := utils.BindJson[dto.OperationListReq](c)
	list, err := op.operaLogic.List(req)
	if err != nil {
		response.Error(c, http.StatusBadRequest, 1002, err.Error(), "获取失败")
		return
	}
	response.OK(c, gin.H{"list": list}, "success", "成功")
}

// Create 新增操作日志
func (op *OperationLogController) Create(c *gin.Context) {

}
